<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
    <style>
        .box {
            width: 100px;
            height: 100px;
            background-color: rebeccapurple;
        }
    </style>
</head>

<body>


    <div class="box"></div>

    <button>取消事件</button>

</body>
<script src="js/jquery.min.js"></script>
<script>
    $(() => {
        $('.box').eq(0).on({
            mouseover: function() {
                $(this).css('backgroundColor', 'red');
            },
            mouseout: function() {
                $(this).css('backgroundColor', 'blue');
            },
            click: function() {
                alert(1);
            }
        });

        document.createElement('span');
        $('.box').append($(document.createElement('span')));

        $('button').on('click', () => {
            $('.box').off();
            alert('事件取消');
        });

    });
</script>

</html>